package dryven.request.http;

import java.io.BufferedWriter;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.io.Writer;

public abstract class AbstractResponse implements Response {

	private Writer _writer;
	
	@Override
	public Writer getResponseWriter() {
		if(_writer==null) {
			try {
				_writer = new BufferedWriter(new OutputStreamWriter(getResponseStream(),"UTF-8"));
			} catch (UnsupportedEncodingException e) {
				throw new RuntimeException(e);
			}
		}
		return _writer;
	}

}
